package Demo3;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-20
 * Time: 22:16
 */
class OutClass{//匿名内部类
    public void test(){
        System.out.println("test()...");
    }
}
interface Va{
   void test();
}

public class Test2 {
    public static void main(String[] args) {
        Va a = new Va(){
            @Override
            public void test() {
                System.out.println("test()...");
            }
        };
        a.test();
    }
    public static void main1(String[] args) {
        new OutClass(){
            @Override
            public void test(){
                System.out.println("test()重写了!");
            }
        }.test();
    }
}
